package com.chixing.day16_io;


import java.io.*;
import java.util.Arrays;

public class BuferedWriterDemo {
    public static void main(String[] args) {
        BufferedWriter bw = null;
        BufferedReader br = null;
        try {
            //封装
             bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("f:/test1/hell1.txt")));
             br = new BufferedReader(new InputStreamReader(new FileInputStream("f:/test1/hell2.txt")));
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
        try {
            bw.write("ssdasdwwdf");
            bw.flush();//刷新缓冲区
            char[] chars = new char[1024];
            int temp;
            int size=0;
            while ((temp=br.read()) !=-1){
                bw.write(temp);
            }


        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            try {

                br.close();
                bw.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }


    }
}
